package com.xmbandu.app.httpnet;

import android.text.TextUtils;

import com.xmbandu.app.utils.SspPrefUtils;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public class AddCookiesInterceptor implements Interceptor {

    @Override
    public Response intercept(Chain chain) throws IOException {
        Request.Builder builder = chain.request().newBuilder();
         if(!TextUtils.isEmpty(SspPrefUtils.getString("token",""))){
            builder.addHeader("XX-Api-Version", "v1");
             builder.addHeader("XX-Token", SspPrefUtils.getString("token",""));

         }
                    return chain.proceed(builder.build());
    }




}


